package controllers;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import systems.Recently;

import entities.ApplicationConfig;
import entities.Article;
import entities.ArticleSearch;

@SuppressWarnings("serial")
public class SitemapServlet extends HttpServlet{
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException {
		
		ApplicationConfig appConfig = (ApplicationConfig) request.getAttribute("sysConfig");
		
		List<Article> articles = Recently.getArticles(appConfig.getApplicationId(), "", "recently_article");
		
		request.setAttribute("articles", articles);
		try {
			request.getRequestDispatcher("/pages/sitemap.jsp").forward(request, response);
		} catch (ServletException e) {
			e.printStackTrace();
		}
	}
}
